def missingNumber(nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        # my_list = sorted(nums)

        # i= 0
        # for i in range(len(my_list)):
        #     if i != my_list[i]:
        #         return i
        # return i+1
        
        #使用异或的方法
        x = 0
        for i in range(len(nums)):
            x = x ^ nums[i]

        for j in range(len(nums)  + 1):
            x = x ^ j
        return x
nums = [0,1]          
result = missingNumber(nums)  
print(f"{result}")